<template>
  <!-- 创建任务 -->
  <div class="createTask">
    <ContentWrap>
      <BasicMsg v-if="step===1" />
      <FiltOrdForClient v-else-if="step===2&&customerType===1" />
      <FiltOrdForShop v-else-if="step===2&&customerType===2" />
      <ImportData v-else-if="step===2&&customerType===0" />
      <SelSeats v-else-if="step===3" />
      <DistributeTask v-else-if="step===4" />
    </ContentWrap>
  </div>
</template>
<script>
import ContentWrap from '@/components/ContentWrap'
import BasicMsg from './components/BasicMsg' // 基本信息
import FiltOrdForShop from './components/FiltOrdForShop' // 筛选订单门店
import FiltOrdForClient from './components/FiltOrdForClient' // 筛选订单电商
import ImportData from './components/ImportData' // 导入数据
import SelSeats from './components/SelSeats' // 选择坐席
import DistributeTask from './components/DistributeTask' // 任务分配
import { mapState } from 'vuex'
export default {
  name: 'CreateTask',
  components: {
    ContentWrap,
    BasicMsg,
    FiltOrdForShop,
    FiltOrdForClient,
    ImportData,
    SelSeats,
    DistributeTask
  },
  data() {
    return {
      id: ''
    }
  },
  computed: {
    ...mapState({
      formData: function(state) {
        const form = state.taskForm.form[this.id]
        return form ? form.basic : {}
      },
      step: function(state) {
        const form = state.taskForm.form[this.id]
        return form ? form.step : 1
      }
    }),
    // 判断客户生成方式（1为筛选订单，w2为导入数据)
    customerType() {
      return this.formData.objectMethod ? this.formData.objectMethod : 0
    }
  },
  activated() {
    this.id = this.$route.query.id
  },
  methods: {
    // ...mapMutations({
    //   SET_RESET: 'taskForm/SET_RESET'
    // })
  }
}
</script>
<style lang='scss' module>
</style>
